const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const DeepScope = require("webpack-deep-scope-plugin").default;
const MiniCss = require("mini-css-extract-plugin")
const PurgecssPlugin = require('purgecss-webpack-plugin')
const path = require('path')
const glob = require('glob')
const PATHS = {
    src: path.join(__dirname, 'src')
  }
  

module.exports = {
    mode: 'production',
    module:{
        rules:[
            {
                test:/\.css$/,
                use:[MiniCss.loader, 'css-loader']
            }
        ]   
    },
    plugins:[
        new CleanWebpackPlugin(),
        new DeepScope(),
        new MiniCss(),
        new PurgecssPlugin({
            paths: glob.sync(`${PATHS.src}/**/*`,  { nodir: true }),
        }),
    ]
}